<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=">
<title>后台管理系统</title>
<link rel="stylesheet" href="__ADMIN_PUBLIC__css/auth.css">
	<script src="__ADMIN_PUBLIC__js/jquery-1.9.1.js"></script>
	<script src="__ADMIN_PUBLIC__js/Layer-1.9.3/layer.js"></script>
<script>
$(function(){
//	$('#account').keyup(function(){
//		var password = $('#password').val();
//		var password2 = $('#password2').val();
//		if(account.length >= 5){
//			$.get("{:U('Admin/Admin/edit_password')}",{"password":password,"password2":password2},function(data){
//					if(data == 1){
//						$('#account_trips').html(' × 账号已存在');
//						$('#account_trips').css('color','red');
//						$('#account_hidden').val(1);
//					}else{
//						$('#account_trips').html(' √ 账号可用');
//						$('#account_trips').css('color','blue');
//						$('#account_hidden').val(0);
//					}
//				}, "json");
//		}
//	});
});
</script>
<script>
function admin_add(){
		var uid = $('#userid').val();
		var password = $('#password').val();
		var password2 = $('#password2').val();
		if(password == ''){
			layer.tips('请输旧入密码', '#password');
			return false;
		}
		if(password2 == ''){
			layer.tips('请输入新密码', '#password2');
			return false;
		}

		$.post(	"__SELF__",{"password":password,"password2":password2},function(data){
				if(data == 1){
					layer.msg('修改成功，正在跳转中...',{icon: 1,time: 2000,shade: [0.8, '#393D49']},function(){
						parent.window.location.reload();    //刷新父页面
					});
				}else if(data == 2){
					layer.msg('修改失败',{icon: 2,time: 2000},function(){
						parent.window.location.reload();
					});
				}else if(data == 3){
					layer.msg('旧密码不正确',{icon: 2,time: 2000},function(){
						parent.window.location.reload();
					});
				}else if(data == 4){
					layer.msg('非法操作',{icon: 2,time: 2000},function(){
						parent.window.location.reload();
					});
				}else{
					layer.msg('修改失败',{icon: 2,time: 2000},function(){
						window.location.reload();
					});
				}
			}, "json");
}
</script>
</head>
<body>
<div class="list">
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="details">
        <tbody>
	      <tr>
	      	<td width="25%"><div align="right">账号：</div></td>
	      	<td width="75%">{$user.user_name}
            <input type="hidden" id="account_hidden" value="0" />
            <span id="account_trips"></span>
            </td>
	      </tr>
          <tr>
	      	<td><div align="right">旧密码：</div></td>
	      	<td><input type="password" name="password" id="password" size="24" value="" /></td>
	      </tr>
          <tr>
            <td><div align="right">新密码：</div></td>
            <td><input type="password" name="password2" id="password2" size="24" value="" /></td>
          </tr>
        </tbody>
  </table>
</div>
<div class="footer">
	<input type="hidden" id="userid" value="">
     <button type="button" class="button" id="button" style="min-width:160px;" onclick="admin_add();">确 认</button>
</div>

</body>
</html>
